package com.alex.taskmanager.threadpool;

import org.slf4j.Logger;

public abstract class WorkerWithLogging implements Worker {

	public abstract Logger getLogger();
	
	public void onError(Exception e) {
		getLogger().error("Error in " + Thread.currentThread().getName() + ": " + e.getMessage(), e);;
	}

	public void onInit() {
		getLogger().info(Thread.currentThread().getName() + " started");	
	}
	
	public void onStop() {
		getLogger().info(Thread.currentThread().getName() + " stopped");	
	}
}
